<template>
  <div class="school">
    <h2>学校名称： {{ name }}</h2>
    <h2>学校地址: {{ address }}</h2>
    <button @click="sendSchoolName">把学校名字给App组件</button>
  </div>
</template>

<script>

export default {
  name: "Student",
  data() {
    return {
      name: '天津123456',
      address: '西青'
    };
  },
  props: ['getSchoolName'],
  methods: {
    sendSchoolName() {
      this.getSchoolName(this.name)
    }
  }
};
</script>

<style scoped>
  .school {
    background: rgb(185, 150, 150);
  }
</style>